import Vue from 'vue'
import VueRouter from 'vue-router'

// ................................
import login from '@/views/login'
import find from '@/views/find'
import topic from '@/views/imitate/topic'
import company from '@/views/company/company.vue'
import Home from '@/views/User/Home.vue'
import personal from '@/views/User/user.vue'
import layout from '@/views/layout'
import test from '@/views/imitate/components/test.vue'

Vue.use(VueRouter)

const routes = [
  { path: '', redirect: '/login' },
  {
    path: '/login',
    name: 'login',
    component: login
  },
  {
    path: '/layout/home/personal',
    name: 'personal',
    component: personal,
    meta: { needLogin: true }
  },
  {
    path: '/layout/topic/test',
    name: 'test',
    component: test,
    meta: { needLogin: true }
  },
  {
    path: '/layout',
    name: 'layout',
    component: layout,
    children: [
      { name: 'find', path: 'find', component: find },
      { name: 'topic', path: 'topic', component: topic },
      { name: 'company', path: 'company', component: company },
      { name: 'Home', path: 'home', component: Home, meta: { needLogin: true } }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
